package com.qqtech.qquan.user.dao;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import com.qqtech.core.common.util.BeanUtil;
import com.qqtech.core.frame.dao.BaseDaoImpl;
import com.qqtech.qquan.user.model.*;

@Repository
public class UserSuggestDaoImpl extends BaseDaoImpl<UserSuggest> implements UserSuggestDao {
	public static final Logger log = LoggerFactory.getLogger(UserSuggestDaoImpl.class);
	
	@Override
	public int queryCountAdmin(UserSuggestQuery query) {
		return sqlSessionTemplate.selectOne(getSqlName("selectCountAdmin"), BeanUtil.toMap(query));
	}
	
	@Override
	public Page<UserSuggestVo> queryPageListAdmin(UserSuggestQuery query,
			Pageable pageable) {
		List<UserSuggestVo> contentList = sqlSessionTemplate.selectList(getSqlName("selectAdmin"), getParams(query, pageable));
		return new PageImpl<UserSuggestVo>(contentList, pageable, this.queryCountAdmin(query));
	}
	
}
